<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>开始使用layui</title>
  <link rel="stylesheet" href="#(base)/layui/css/layui.css">
</head>
<body >

<div class="layui-layout layui-layout-admin">
 
</div>

<div class="layui-container">  
  常规布局（以中型屏幕桌面为例）：
  <div class="layui-row">
    <div class="layui-col-md9">
    <input type="button" class="layui-bg-green">
    #include("admin_left.html")
 <input type="file" id="pic" name="pic" class="layui-bg-green">
      你的内容 9/12 <i class="layui-icon layui-icon-face-smile"></i><i class="layui-icon layui-icon-speaker"></i>
      
      <form class="layui-form" action="">
  <div class="layui-form-item">
    <label class="layui-form-label">输入框</label>
    <div class="layui-input-block">
      <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">密码框</label>
    <div class="layui-input-inline">
      <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-form-mid layui-word-aux">辅助文字</div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">选择框</label>
    <div class="layui-input-block">
      <select name="city" lay-verify="required">
        <option value=""></option>
        <option value="0">北京</option>
        <option value="1">上海</option>
        <option value="2">广州</option>
        <option value="3">深圳</option>
        <option value="4">杭州</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">复选框</label>
    <div class="layui-input-block">
      <input type="checkbox" name="like[write]" title="写作">
      <input type="checkbox" name="like[read]" title="阅读" checked>
      <input type="checkbox" name="like[dai]" title="发呆">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">开关</label>
    <div class="layui-input-block">
      <input type="checkbox" name="switch" lay-skin="switch">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">单选框</label>
    <div class="layui-input-block">
      <input type="radio" name="sex" value="男" title="男">
      <input type="radio" name="sex" value="女" title="女" checked>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">文本域</label>
    <div class="layui-input-block">
      <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>


		<table class="layui-table">
		  <colgroup>
		    <col width="150">
		    <col width="200">
		    <col>
		  </colgroup>
		  <thead>
		    <tr>
		      <th>昵称</th>
		      <th>加入时间</th>
		      <th>签名</th>
		    </tr> 
		  </thead>
		  <tbody>
		  	#for(one : table.getList())
		    <tr>
		      <td>#(one.name)</td>
		      <td>#(one.updatetime)</td>
		      <td>#(one.phone)</td>
		    </tr>
		   	#end
		  </tbody>
		</table>
		<div id="pageDiv" class="no-print"></div>
<!-- 		#@paginate(table.pageNumber, table.totalPage, "/blog/") -->
    </div>
    <div class="layui-col-md3">
      你的内容 3/12<a href="http://www.layui.com" class="layui-btn"><i class="layui-icon layui-icon-face-smile"></i>一个可跳转的按钮</a>
    </div>
  </div>
</div>  
<script src="#(base)/js/jquery-2.1.4.min.js"></script> 
<script src="#(base)/layui/layui.js"></script>
<script>
//一般直接写在一个js文件中
layui.use(['layer', 'form'], function(){
  var layer = layui.layer
  ,form = layui.form;
  
  layer.msg('Hello World');
  console.log(layui.device());
  var device = layui.device('myapp');
  if(device.myapp){
    alert('在我的App环境');
  } 
  //监听提交
  form.on('submit(formDemo)', function(data){
    layer.msg(JSON.stringify(data.field));
    return false;
  });
});

layui.use('upload', function(){
	  var upload = layui.upload;
	  //执行实例
	  var result = upload.render({
	    elem: '#pic' //绑定元素
	    ,url: '#(base)/util/uploadFile' //上传接口
	    ,accept: 'file' // file 允许上传的文件类型
	    ,done: function(res,index,upload){
	      //上传完毕回调
	      console.log("res:"+res["url"]);
	      console.log("res1:"+res.url);
	    }
	    ,error: function(error){
	      //请求异常回调
	      console.log("error:" + error);
	    }
	  });
});

layer.open({
        type: 1
//	        ,offset: type 
        ,id: 'layerDemo1' //防止重复弹出
        ,area:'280px'
        ,content: '<div style="padding:10px 20px;">hello world!</div>'
        ,btn: '详情请点击'
        ,btnAlign: 'c' //按钮居中
        ,shade: 0 //不显示遮罩
        ,yes: function(){
          layer.closeAll();
        }
});

layui.use('laypage', function () {
    var laypage = layui.laypage;
    laypage.render({
        elem: "pageDiv",
        count:#(table.totalRow),
        limit: 10,
        curr:#(table.pageNumber),
        layout: ['count', 'prev', 'page', 'next', 'skip'],
        jump: function (obj, first) {
            var pageIndex = obj.curr;
            if (!first) {
                // $("#pageIndex").val(pageIndex - 1);
                // $("#dataForm").submit();
            }
        }
    });
})
</script> 
</body>
</html>